import fetch from '@/utils/fetch'

export function apiGetOfficeList(listQuery) {
  return fetch({
    url: '/api/v1/office/list',
    method: 'get',
    params: listQuery
  })
}

export function apiGetOfficeById(officeId) {
  return fetch({
    url: '/api/v1/office',
    method: 'get',
    params: {
      id: officeId
    }
  })
}

export function apiAddOffice(officeDto) {
  return fetch({
    url: '/api/v1/office',
    method: 'post',
    data: officeDto
  })
}

export function apiUpdOffice(officeDto) {
  return fetch({
    url: '/api/v1/office',
    method: 'put',
    data: officeDto
  })
}

export function apiGetReceiver(listQuery) {
  return fetch({
    url: '/api/v1/office/receiver',
    method: 'GET',
    params: listQuery
  })
}

export function apiDelOffice(officeId) {
  return fetch({
    url: '/api/v1/office',
    method: 'delete',
    params: {
      id: officeId
    }
  })
}

export function apiExport (listQuery) {
  return fetch({
    url: '/api/v1/office/export',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}

// 所有接收人(外包商+办事处)
export function apiGetAllReceiver(listQuery) {
  return fetch({
    url: '/api/v1/office/all/receiver',
    method: 'GET',
    params: listQuery
  })
}
